package com.one.blocks.rbac.controller.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.one.blocks.mvc.controller.valid.Update;
import com.one.blocks.mvc.controller.valid.UpdateSelective;
import com.one.blocks.mvc.domain.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import java.io.Serializable;

/**
 * @author <a href="mailto:idler41@163.con">idler41</a> created on 2022-05-02 19:34:53
 */
@ApiModel(value = "系统登录账户")
@Data
public class SysAccountVo implements Id<Integer>, Serializable {

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    @NotNull(groups = {UpdateSelective.class, Update.class})
    private Integer id;

    /**
     * 登录用户名
     */
    @ApiModelProperty(value = "登录用户名")
    @NotNull(groups = {Default.class, Update.class})
    private String username;

    /**
     * 登陆密码
     */
    @ApiModelProperty(value = "登陆密码")
    @NotNull(groups = {Default.class, Update.class})
    private String password;

    /**
     * 登录手机号
     */
    @ApiModelProperty(value = "登录手机号")
    private String mobile;

    /**
     * 登录邮箱
     */
    @ApiModelProperty(value = "登录邮箱")
    private String email;

    /**
     * 用户状态: 0-禁用 1-正常
     */
    @ApiModelProperty(value = "用户状态: 0-禁用 1-正常")
    @NotNull(groups = {Update.class})
    @Range(min = 0, max = 1, groups = {Update.class})
    private Integer state;

    /**
     * 创建者
     */
    @ApiModelProperty(value = "创建者", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Integer createBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Long createTime;

    /**
     * 更新者
     */
    @ApiModelProperty(value = "更新者", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Integer updateBy;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间", accessMode = ApiModelProperty.AccessMode.READ_ONLY)
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Long updateTime;
}